

package com.suzj.extraenchantments;

import java.util.Collections;
import java.util.List;

import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.common.ForgeConfigSpec;
import org.apache.commons.lang3.tuple.Pair;

public class Config {
    public static ForgeConfigSpec SERVER_CONFIG;
    public static ForgeConfigSpec CLIENT_CONFIG;
    public static ServerConfig SERVER;
    public static ClientConfig CLIENT;

    private static ForgeConfigSpec.BooleanValue buildBoolean(ForgeConfigSpec.Builder builder, String name, boolean defaultValue, String comment) {
        return builder.comment(comment).translation(name).define(name, defaultValue);
    }

    private static ForgeConfigSpec.IntValue buildInt(ForgeConfigSpec.Builder builder, String name, int defaultValue, int min, int max, String comment) {
        return builder.comment(comment).translation(name).defineInRange(name, defaultValue, min, max);
    }

    private static ForgeConfigSpec.DoubleValue buildDouble(ForgeConfigSpec.Builder builder, String name, double defaultValue, double min, double max, String comment) {
        return builder.comment(comment).translation(name).defineInRange(name, defaultValue, min, max);
    }

    private static ForgeConfigSpec.ConfigValue<List<? extends String>> buildConfig(ForgeConfigSpec.Builder builder, String name, String comment) {
        return builder.comment(comment).translation(name).defineList(name, Collections.emptyList(), (s) -> s instanceof String && ResourceLocation.tryParse((String)s) != null);
    }

    static {
        Pair<ClientConfig, ForgeConfigSpec> specPair1 = (new ForgeConfigSpec.Builder()).configure(ClientConfig::new);
        CLIENT = specPair1.getLeft();
        CLIENT_CONFIG = specPair1.getRight();
        final Pair<ServerConfig, ForgeConfigSpec> specPair = new ForgeConfigSpec.Builder().configure(ServerConfig::new);
        SERVER_CONFIG = specPair.getRight();
        SERVER = specPair.getLeft();
    }

    public static class ServerConfig {
        public final ForgeConfigSpec.BooleanValue isInlaidHarp;
        public final ForgeConfigSpec.BooleanValue isInsight;
        public final ForgeConfigSpec.BooleanValue isKnightsShield;
        public final ForgeConfigSpec.BooleanValue isLifeProtection;
        public final ForgeConfigSpec.BooleanValue isMedea;
        public final ForgeConfigSpec.BooleanValue isPlayFavorites;
        public final ForgeConfigSpec.BooleanValue isSycamore;
        public final ForgeConfigSpec.BooleanValue isChaos;
        public final ForgeConfigSpec.BooleanValue isVoidBlessing;
        public final ForgeConfigSpec.BooleanValue isVoidStrike;
        public final ForgeConfigSpec.BooleanValue isCataclysmicVariableStar;
        public final ForgeConfigSpec.BooleanValue isSkidding;
        public final ForgeConfigSpec.BooleanValue isDestructiveAccretion;
        public final ForgeConfigSpec.BooleanValue isFireTransit;
        public final ForgeConfigSpec.BooleanValue isDiligence;
        public final ForgeConfigSpec.BooleanValue isThief;
        public final ForgeConfigSpec.BooleanValue isThroughTheValley;
        public final ForgeConfigSpec.BooleanValue isTheLamb;
        public final ForgeConfigSpec.BooleanValue isTearsGifts;
        public final ForgeConfigSpec.BooleanValue isPlagueHive;
        public final ForgeConfigSpec.BooleanValue isInfiniteWisdom;
        public final ForgeConfigSpec.BooleanValue isFlowMyTears;
        public final ForgeConfigSpec.BooleanValue isMicroscopicReordering;
        public final ForgeConfigSpec.BooleanValue isBehead;
        public final ForgeConfigSpec.BooleanValue isQuenching;
        public final ForgeConfigSpec.BooleanValue isTemperedWings;
        public final ForgeConfigSpec.BooleanValue isFirecracker;
        public final ForgeConfigSpec.BooleanValue isTheCallOfPlague;

        public ServerConfig(ForgeConfigSpec.Builder builder) {
            builder.comment("ExtraEnchantments enchant is effective Config").push("general");
            this.isInlaidHarp = Config.buildBoolean(builder, "Inlaid Harp", true, "enchant is effective");
            this.isInsight = Config.buildBoolean(builder, "Insight", true, "enchant is effective");
            this.isKnightsShield = Config.buildBoolean(builder, "Knights Shield", true, "enchant is effective");
            this.isLifeProtection = Config.buildBoolean(builder, "Life Protection", true, "enchant is effective");
            this.isMedea = Config.buildBoolean(builder, "Medea", true, "enchant is effective");
            this.isPlayFavorites = Config.buildBoolean(builder, "Play Favorites", true, "enchant is effective");
            this.isSycamore = Config.buildBoolean(builder, "Sycamore", true, "enchant is effective");
            this.isChaos = Config.buildBoolean(builder, "Chaos", true, "enchant is effective");
            this.isVoidStrike = Config.buildBoolean(builder, "Void Strike", true, "enchant is effective");
            this.isVoidBlessing = Config.buildBoolean(builder, "Void Blessing", true, "enchant is effective");
            this.isCataclysmicVariableStar = Config.buildBoolean(builder, "Cataclysmic Variable Star", true, "enchant is effective");
            this.isSkidding = Config.buildBoolean(builder, "Skidding", true, "enchant is effective");
            this.isDestructiveAccretion = Config.buildBoolean(builder, "Destructive Accretion", true, "enchant is effective");
            this.isFireTransit = Config.buildBoolean(builder, "Fire Transit", true, "enchant is effective");
            this.isDiligence = Config.buildBoolean(builder, "Diligence", true, "enchant is effective");
            this.isThief = Config.buildBoolean(builder, "Thief", true, "enchant is effective");
            this.isThroughTheValley = Config.buildBoolean(builder, "Through the Valley", true, "enchant is effective");
            this.isTheLamb = Config.buildBoolean(builder, "Weep Not For Me, My Lamb", true, "enchant is effective");
            this.isTearsGifts = Config.buildBoolean(builder, "Tears, are also gifts", true, "enchant is effective");
            this.isPlagueHive = Config.buildBoolean(builder, "Plague Hive", true, "enchant is effective");
            this.isInfiniteWisdom = Config.buildBoolean(builder, "The Tome of Infinite Wisdom", true, "enchant is effective");
            this.isFlowMyTears = Config.buildBoolean(builder, "Flow My Tears", true, "enchant is effective");
            this.isMicroscopicReordering = Config.buildBoolean(builder, "Microscopic Reordering", true, "enchant is effective");
            this.isBehead = Config.buildBoolean(builder, "Behead", true, "enchant is effective");
            this.isQuenching = Config.buildBoolean(builder, "Quenching", true, "enchant is effective");
            this.isTemperedWings = Config.buildBoolean(builder, "Tempered Wings", true, "enchant is effective");
            this.isFirecracker = Config.buildBoolean(builder, "Firecracker", true, "enchant is effective");
            this.isTheCallOfPlague = Config.buildBoolean(builder, "The Call of Plague", true, "enchant is effective");
            builder.pop();
        }
    }

    public static class ClientConfig {
        public ClientConfig(ForgeConfigSpec.Builder builder) {
        }
    }
}
